package com.football.springboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.football.springboot.entity.LeagueTeam;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface LeagueTeamMapper extends BaseMapper<LeagueTeam> {

    //联赛分配球队第一步，先删掉选择的球队
    @Delete("delete from league_team where league_id= #{leagueId}")
    int deleteByLeagueId(@Param("leagueId") Integer leagueId);

    //根据选择的联赛id找到选择的球队
    @Select("select team_id from league_team where league_id = #{leagueId}")
    List<Integer> selectByLeagueId(@Param("leagueId") Integer leagueId);

    //根据选择的球队id找到参加的联赛id
    @Select("select league_id from league_team where team_id = #{teamId}")
    List<Integer> selectByTeamId(@Param("teamId") Integer teamId);


}
